/***********************************************************************
 * Module:  TypedElement.java
 * Author:  Stefan
 * Purpose: Defines the Class TypedElement
 ***********************************************************************/
package org.dslintegration.merge.km3.core;

/** @pdOid 8c99d2c1-4074-4144-9119-53f3aa56b26f */
public abstract class TypedElement extends ModelElement {
	protected int lower;
	protected int upper;
	protected boolean isOrdered;
	protected boolean isUnique;
	protected Class parent;

	protected Classifier type;

	public int getLower() {
		return lower;
	}

	public void setLower(int lower) {
		this.lower = lower;
	}

	public int getUpper() {
		return upper;
	}

	public void setUpper(int upper) {
		this.upper = upper;
	}

	public boolean isOrdered() {
		return isOrdered;
	}

	public void setOrdered(boolean isOrdered) {
		this.isOrdered = isOrdered;
	}

	public boolean isUnique() {
		return isUnique;
	}

	public void setUnique(boolean isUnique) {
		this.isUnique = isUnique;
	}

	public Classifier getType() {
		return type;
	}

	public void setType(Classifier type) {
		this.type = type;
	}

	public Class getParent() {
		return parent;
	}

	public void setParent(Class parent) {
		this.parent = parent;
	}
	
	public String getMultiplicity() {
		if(lower==0 && upper== 1)
			return "";
		return "["+lower+"-"+(upper==0?"*":upper)+"]";
	}

	public String getQName() {
		return getParent().getQName().substring(0, 1).toLowerCase() + getParent().getQName().substring(1) + "." + this.getName();
	}
}